export * from './hooks/use-mount'
export * from './hooks/use-async'
export * from './hooks/use-array'

/**
 * @method isVoid
 * @description 判断传入值是否为空
 * @param {unknown} value
 * @returns {boolean}
 */
export const isVoid = (value: unknown) =>
  value === undefined || value === null || value === ''

/**
 * @method cleanObject
 * @description 清除对象内为空的键
 * @param {object} object
 * @returns {object}
 */
export const cleanObject = (object?: { [key: string]: unknown }) => {
  if (!object) return {}
  const o = { ...object }
  Object.keys(o).forEach((key) => {
    if (isVoid(o[key])) delete o[key]
  })
  return o
}
